package es.empresa.domain.admin;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.persistence.ManyToOne;
import java.util.Set;

import es.empresa.domain.admin.Ingrediente;
import es.empresa.domain.admin.TProducto;

import java.util.HashSet;
import javax.persistence.ManyToMany;
import javax.persistence.CascadeType;

@RooJavaBean
@RooToString
@RooEntity
public class Producto {

    @NotNull
    @Size(min = 2, max = 256)
    private String nombre;

    @Size(max = 1024)
    private String descripcion;

    private Float precio;

    @Size(max = 1024)
    private String imagen;

    private Double calorias;

    @ManyToOne
    private TProducto tipo_producto;

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Ingrediente> ingredientes = new HashSet<Ingrediente>();
}
